import { axios } from "../utils/request";
// import qs from "qs";

const api = {
  PageList: "/sysMenu/system/page",
  Save:     "/sysMenu/system/saveSysMenu",
  Delete:   "/sysMenu/system/delete",
  batchUpdateTreeSorts: "/sysMenu/system/batchUpdateTreeSorts",
  AdminMenu: "/sysMenu/system/getAdminMenu"
};

/**
 * 获取菜单列表
 * parameter: {
 *     name: '',
 *     menuType: 1
 * }
 * @param parameter
 * @returns {*}
 */
export function PageList(parameter) {
  return axios({
    url: api.PageList,
    method: "get",
    params: parameter
  });
  
};

/**
 * 新增/编辑菜单
 * @param {*} data
 */
export function saveSysMenu(data) {
  return axios({
    url: api.Save,
    method: "post",
    data: data
    // headers: {
    //   'Content-Type': 'application/json;charset=UTF-8'
    // }
  });
};

/**
 * 删除菜单
 * @param {*} parameter 
 */
export function DeleteOne(parameter) {
  return axios({
    url: api.Delete,
    method: "DELETE",
    params: parameter
  });
};


/**
 * 批量更新 菜单排序
 * @param {*} data
 */
export function batchUpdateTreeSorts(data) {
  return axios({
    url: api.batchUpdateTreeSorts,
    method: "post",
    data: data
    // headers: {
    //   'Content-Type': 'application/json;charset=UTF-8'
    // }
  });
};

/**
 * 获取系统管理员菜单
 */
export function adminMenu(data) {
  return axios({
    url: api.AdminMenu,
    method: "get",
    params: data
  });
}